package com.lzp.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.Map;

/**
 * @description: hello
 * @author: lzp
 * @createTime: 2021-09-24 07:32
 **/
@Controller
public class HelloController {

    /**
     * 用modelMap，Map都是一样的
     *
     * @param map
     * @return
     */
    @RequestMapping("success")
    public String success(Map<String, Object> map) {
        map.put("key", "<h1>Title</h1>");
        map.put("list", Arrays.asList("cat", "dog"));
        return "test1";
    }

    @RequestMapping("method")
    @ResponseBody
    public String method() {
        return "method";
    }
}

